/**
 * 
 */
package com.xxl.job.core.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xxl.job.core.biz.impl.ExecutorBizImpl;
import com.xxl.job.core.biz.model.IdleBeatParam;
import com.xxl.job.core.biz.model.KillParam;
import com.xxl.job.core.biz.model.LogParam;
import com.xxl.job.core.biz.model.LogResult;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam;

/**
 * 描述：
 * 
 * <pre>
 * 为Job - Admin提供调用服务
 * </pre>
 * 
 * @author qizai
 * @version: 0.0.1 2021年5月10日-下午3:09:39
 *
 */
@RestController
@RequestMapping("/api/xxl-job")
public class XxlJobController {

	@Autowired
	private ExecutorBizImpl executorBizImpl;

	@PostMapping("/beat")
	public ReturnT<String> beat() {
		return executorBizImpl.beat();
	}

	@PostMapping("/idleBeat")
	public ReturnT<String> idleBeat(@RequestBody IdleBeatParam param) {
		return executorBizImpl.idleBeat(param);
	}

	@PostMapping("/run")
	public ReturnT<String> run(@RequestBody TriggerParam param) {
		return executorBizImpl.run(param);
	}

	@PostMapping("/kill")
	public ReturnT<String> kill(@RequestBody KillParam param) {
		return executorBizImpl.kill(param);
	}

	@PostMapping("/log")
	public ReturnT<LogResult> log(@RequestBody LogParam param) {
		return executorBizImpl.log(param);
	}
}
